<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
{% include "ic/head.html" with context %}
<body>
    <div id="wrapper">
                <nav class="navbar navbar-default navbar-cls-top " role="navigation" style="margin-bottom: 0">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar-collapse">
                <div class="text-box" >
                </div>
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="/italiaCives"></a>
            </div>
  <div style="color: white;
padding: 15px 0px 5px 5px;
float: right;
font-size: 16px;"></div>
        </nav>
           <!-- /. NAV TOP  -->
                   <nav class="navbar-default navbar-side" role="navigation">
            <div class="sidebar-collapse col-sm">
                <ul class="nav" id="main-menu">
                    <li>
                        <a  {{ 'class="active-menu"' if req.environ["PATH_INFO"] == "/italiaCives" }} href="/italiaCives"><i style="color:#000000" class="fa fa-home fa-3x"></i>Home</a>
                    </li>

                    <li>
                        <a href="/italiaCives/main_cms/info" data-target="#myModall" role="button" data-toggle="modal" data-backdrop="static"  id="anteprima"><i style="color:#000000" class="fa fa-info-circle fa-3x"></i>Info</a>
                    </li>

                        </ul>

            </div>

        </nav>
<div id="page-wrapper" >

    <div class="omb_login">
        <h3 class="omb_authTitle">Cerca il tuo comune in<a href="#"> Italia Cives</a></h3>

        <div class="row omb_row-sm-offset-4">
            <div class="col-xs-12 col-sm-12">
                <form class="omb_loginForm" action="/italiaCives/dashboard" autocomplete="off" method="POST">
                    <input type="hidden" name="id_ente" id="id_ente" value=""/>

                 <div class="col-xs-12 col-sm-6 col-lg-12 input-group">
                    <input class="form-control" type="text" name="ente" id="ricerca_entry_articolo" placeholder="Inserisci qui la tua ricerca" >
                    <a class="search_cmplx input-group-addon" id="ricerca_complessa_articolo" href="#">
                        <span class="glyphicon glyphicon-search" data-target="#myModal"></span>
                    </a>
                </div>
                <br/>
                    <button class="btn btn-lg btn-primary btn-block" type="submit">Seleziona!</button>
                </form>
            </div>
        </div>
        <h2>Notizie da ItaliaCives</h2>
        {% for news in pageData['newss'] %}
<div class="row">
                    <div class="col-xs-12 col-md-12 col-lg-12 col-sm-12">
                    <div class="panel panel-info">
                        <div class="panel-heading">
                            <a href="/pg/ac_main_News/Preview?id={{news.id}}&pp=1" role="button" data-backdrop="static"  id="anteprima" class="list-group-item celestino">[{{news.tipo_news}}] <strong>{{news.title}}</strong></a>
                        </div>
                        <div class="panel-body">
                            {{news.abstract}}
                        </div>
                        <div class="panel-footer">
                            {{news.publication_date|datetimeformat}}
                        </div>
                    </div>
                </div>
</div>
        {% endfor %}
    </div>

 <!-- /#wrapper -->
    {% include "ic/scripts.html" with context %}
<!--
<script src="/tpl/pg/js/plugins/jquery-ui/ui/minified/jquery-ui.min.js"></script>
-->
<script type="text/javascript">
$(document).ready(function(){

//$( "#ricerca_entry_articolo" ).autocomplete({
    //source: "/pg/as_Ente/GetEnti?servizio=ItaliaCives",
    //select: function( event, ui ) {
        ////event.preventDefault(); //blocco il default perchè mi serve il campo svuotato
        //$("#id_ente").val(ui.item.id_ente);
        //$( "#ricerca_entry_articolo" ).autocomplete( "close" );
    //}
        //});

//$( "#ricerca_entry_articolo" ).autocomplete({
    //serviceUrl: "/pg/as_Ente/GetEnti?servizio=ItaliaCives",
    //select: function( event, ui ) {
        ////event.preventDefault(); //blocco il default perchè mi serve il campo svuotato
        //$("#id_ente").val(ui.item.id_ente);
        //$( "#ricerca_entry_articolo" ).autocomplete( "close" );
    //}
        //});


var a = $('#ricerca_entry_articolo').autocomplete({
    serviceUrl:'/pg/as_Ente/GetEnti?servizio=ItaliaCives',
    minChars:2,
    delimiter: /(,|;)\s*/, // regex or character
    maxHeight:400,
    width:300,
    zIndex: 9999,
    deferRequestBy: 0, //miliseconds
    //params: { country:'Yes' }, //aditional parameters
    noCache: false, //default is false, set to true to disable caching
    // callback function:
    onSelect: function(value, data){
        $("#id_ente").val(value.id_ente);
        },
    // local autosugest options:
    //lookup: ['January', 'February', 'March', 'April', 'May'] //local lookup values
});


});
</script>

</body>
